﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
  
/// <summary>
/// 命名空间
/// </summary>
namespace Form01
{   
    /// <summary>
    /// 窗体 类
    /// </summary>
    public partial class FrmLogin : Form
    {
         /// <summary>
         /// 构造函数
         /// </summary>
        public FrmLogin()
        {
            InitializeComponent();
        }
       
        private void FrmLogin_Load(object sender, EventArgs e)
        {
          
        }

        /// <summary>
        ///    退出程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            //this.Close();//关闭当前窗体
            // Environment.Exit(-1);//退出应用程序
            Application.Exit(); //退出应用程序 
        }

        /// <summary>
        /// 登陆事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            // FrmMainFrom frm = new FrmMainFrom();
            Users frm = new Users();

            string a = "amdin";
            string b = "jzws0927";
            if (txtUserNo.Text==a && txtpassword.Text==b)
            {
                MessageBox.Show("登录成功");
                frm.Show();   //显示主FrmMainFrom窗口
                this.Hide();   //隐藏当前窗口
            }
            else if (txtUserNo.Text == "" || txtpassword.Text == "")
            {
                MessageBox.Show("用户名或密码不能为空");
                txtUserNo.Focus();
            }
            else
            {
                MessageBox.Show("用户名或密码错误");
                txtpassword.Clear();
                txtUserNo.Clear();
                txtUserNo.Focus();
            }

        }

        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRegister_Click(object sender, EventArgs e)
        {
            FrmRegister frm = new FrmRegister();
            frm.Show();      //显示FrmRerister窗口
            this.Hide();
        }

        private void lblUserNo_Click(object sender, EventArgs e)
        {

        }
    }
}
